package 单例;

/**
 * 双重检查锁
 */
public class DCL {
    private static volatile Test test = null;

    private DCL() {

    }

    private Test getTest() {
        if (test == null) {
            synchronized (DCL.class) {
                if (test == null) {
                    test = new Test();
                }
            }
        }
        return test;
    }
}
